#!/bin/bash

#Created by turk 2016-10-28
#Version 1.0 



if [ $# -lt 1 ]; then
	echo `date +"%Y-%m-%d %H:%M:%S"`  "Usage:<DATE1 YYYYMMDD> <DATA2 YYYY-MM-DD>"
	exit 1
fi

DATE1=$1
DATE2=$2

WORKPATH=/home/oracle/work/
LOGFILE=${WORKPATH}/log/oracle_backup.log

DATAPATH=/crdata/backup

#--ORACLE--
TNS=BSMP
USERNAME=sds
PASSWORD=h16aug8v3w


echo `date +"%Y-%m-%d %H:%M:%S"`  "-----------------------------" | tee -a $LOGFILE
echo `date +"%Y-%m-%d %H:%M:%S"`  "Shell Version 1.0 (2016-10-28)"     | tee -a $LOGFILE
echo `date +"%Y-%m-%d %H:%M:%S"`  "ORACLE BACKUP"  | tee -a $LOGFILE
echo `date +"%Y-%m-%d %H:%M:%S"`  "-----------------------------"  | tee -a $LOGFILE
echo `date +"%Y-%m-%d %H:%M:%S"`  "Start..."  | tee -a $LOGFILE


mkdir -p $DATAPATH/$DATE1/
exp $USERNAME/$PASSWORD@$TNS BUFFER=64000 FILE=$DATAPATH/$DATE1/SDS_OBJ.DMP OWNER=SDS log=/crdata/backup/$DATE1/SDS_TABLE.log

echo `date +"%Y-%m-%d %H:%M:%S"`      "Quit" | tee -a $LOGFILE

exit 0
